package org.example.design.abstractFactory.itf.impl;

import org.example.design.abstractFactory.itf.ICacheAdapter;
import org.example.design.abstractFactory.matter.EGM;

import java.util.concurrent.TimeUnit;

/**
 * @Classname EGMCacheAdapter
 * @Description EGM集群具体实现
 * @Date 2020/10/30 3:21 下午
 * @Created by xiangjd
 */
public class EGMCacheAdapter implements ICacheAdapter {

     private  EGM egm = new EGM();
    @Override
    public String get(String key) {
        return egm.gain(key);
    }

    @Override
    public void set(String key, String value) {
          egm.set(key,value);
    }

    @Override
    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
      egm.setEx(key, value, timeout, timeUnit);
    }

    @Override
    public void del(String key) {
       egm.delete(key);
    }
}
